file_copy

语法:

file_copy(fname, newname);


参数 描述
fname 要复制的文件的名称。
newname 复制文件的新名称。


返回: N/A(无返回值)


描述

此函数将复制指定的文件,为其指定你选择的新名称。 如果你在 内含文件 区域(将在 APK 中)复制 Android 上的文件,它将首先复制到内存中,因此,请注意,从 APK 复制非常大的文件可能会导致设备内存不足。On the HTML5 target, we use the HTML5 Local Storage API for client side saving, and the functions does not support binary file operations, so assumes you are copying a text file.


警告! 此函数可能无法正常工作! 因为 GameMaker Studio 2 被沙盒化。有关详细信息,请参阅 文件系统限制 部分。


例如:

if file_exists("level1.txt")
   {
   file_copy("level1.txt", "level2.txt");
   }

这将检查文件,如果存在则复制。